from django.urls import re_path,path
from . import views

urlpatterns = [
    # 判断用户名是否重复
    path('usernames/<username:username>/count/',views.UsernameCountView.as_view()),
    # 判断手机号时否重复
    path('mobiles/<mobile:mobile>/count/', views.MobileCountView.as_view()),
    # 用户注册POST: http://www.meiduo.site:8000/register
    path('register/', views.RegisterView.as_view()),
    # 用户登录POST://http://www.meiduo.site:8000/login
    path('login/', views.LoginView.as_view()),
    # 退出登录：DELETE: logout/
    path('logout/', views.LogoutView.as_view()),
    # 用户中心 GET: info/
    path('info/', views.UserInfoView.as_view()),
    # 添加邮箱 PUT: /emails/
    path('emails/', views.EmailView.as_view()),
    # 邮箱验证 PUT: /emails/verification/
    path('emails/verification/', views.VerifyEmailView.as_view()),
    # 新增收货地址： POST: /addresses/create/
    path('addresses/create/', views.CreateAddressView.as_view()),
    # 显示用户收货地址： GET: /addresses/
    path('addresses/', views.AddressView.as_view()),
    # 修改和删除收货地址： PUT: /addresses/(?P<address_id>\d+)/
    re_path(r'^addresses/(?P<address_id>\d+)/$',views.UpdateDestroyAddressView.as_view()),
    # 设置默认地址： PUT: /addresses/(?P<address_id>\d+)/default/
    re_path(r'^addresses/(?P<address_id>\d+)/default/$', views.DefaultAddressView.as_view()),
    # 修改地址标题： PUT； /addresses/(?P<address_id>\d+)/title/
    re_path(r'^addresses/(?P<address_id>\d+)/title/$', views.UpdateTitleAddressView.as_view()),
    # 修改密码: PUT: /password/
    path('password/', views.ChangePasswordView.as_view()),
]